class Node:
    def __init__(self,item):
        self.item=item
        self.next=None

#头插法
def create_linklist(li):
    head=Node(li[0])
    for element in li[1:]:
        node=Node(element)
        node.next=head
        head=node
    return head

def create_linklist_tail(li):
    head=Node(li[0])
    tail=head
    for element in li[1:]:
        node=Node(element)
        tail.next=node
        tail=node
    return head

def print_linkelist(lk):
    while lk:
        print(lk.item, end=',')
        lk=lk.next


lk = create_linklist([1, 2, 3])
print(print_linkelist(lk))